#ifdef USE_LOADGEN_GUI


#ifndef FILEIO_H
#define FILEIO_H

/**
@author Christophe Vandeplas
*/
#include <QObject>
#include <QFileDialog>
#include <QMessageBox>
#include <QtDebug>
#include <QString>


class FileIO : public QObject{
  Q_OBJECT
    public:
        static FileIO* getInstance();
        static const int OK                =  0;
        static const int ERROR             =  1;
        static const int USER_CANCELLED    =  2;
        static const int OPEN_NOT_FOUND    = 20;
        static const int OPEN_CORRUPT_FILE = 22;
        void errorDialog(int errorNo,QString error="");
        QString errorStr;

    public slots:                                       // user-reachable functions
        int menuClose();                                // tries to close(), and then removes the maps, waypoints,
        int menuOpen();
        int menuHistorySave();
        int menuHistorySaveAll();

    signals:
        void loadNewScene( const QString ) ;
        void whatIsTheSelectedThreadId(int &);

    private:
        int open(QString file);                             // open the file
        int close();                                        // handles the save first? call
        static FileIO *theInstance;                         // SINGLETON
        FileIO();
        ~FileIO();
        QString currentFile;                                // the file we are working with
        int saveHistoryDialog(int threadId);
};


#endif /*FILEIO_H*/


#endif // USE_LOADGEN_GUI

